<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>北京市昌平振华学校</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
     <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
     <script type="text/javascript">
                $(function () {
                totalComputer();
                    $(".amt").mouseout(function () {
                        totalComputer();
                    });
                    $("#feeId").blur(function () {
                        totalComputer();
                    });
                    $("#doprintId").click(function () {
                        $("#psname").text($("#snameId").val());
                        $("#pphone").text($("#phoneId").val());
                        $("#pclass").text($("#yearId").val()+$("#classId").val());

                        $("#pfee").text($("#feeId").val());

                        $("#pzq").text($("#zyearId").val()+$("#ztermId").val());

                        $("#pzc").text(getCheckBox($("#zcId")));
                        $("#pwc").text(getCheckBox($("#wcId")));
                        $("#pwac").text(getCheckBox($("#wacId")));
                        $("#pbc").text(getCheckBox($("#bcId")));
                        $("#pbx").text(getCheckBox($("#bxId")));
                        $("#pxf").text(getCheckBox($("#xfId")));
                        $("#pzs").text(getCheckBox($("#zsId")));

                        $("#psfr").text($("#sfyId").val());
                        $("#totalId").text($("#totalAmt").val());

                        var htmlstr = $("#printAearId").html();
                        window.document.body.innerHTML=htmlstr
                        window.print();
                        window.location.reload();
                    });
                    // 获取值
                    function getCheckBox(obj) {
                        if(obj.is(':checked'))
                            return $("#wcId").val();
                        return 0
                    }

                    // 账单计算
                    function totalComputer() {

                        var feeAmt = 0;
                        if (!isNaN($("#feeId").val())) {
                            feeAmt = parseFloat($("#feeId").val());
                        }
                        var zcAmt = 0;
                        if (!isNaN($("#zcId").val()) && $("#zcId").is(':checked')) {
                            zcAmt = parseFloat($("#zcId").val());
                        }
                        var wcAmt = 0;
                        if (!isNaN($("#wcId").val()) && $("#wcId").is(':checked')) {
                            wcAmt = parseFloat($("#wcId").val());
                        }
                        var wacAmt = 0
                        if (!isNaN($("#wacId").val()) && $("#wacId").is(':checked')) {
                            wacAmt = parseFloat($("#wacId").val());
                        }
                        var bcAmt = 0;
                        if (!isNaN($("#bcId").val()) && $("#bcId").is(':checked')) {
                            bcAmt = parseFloat($("#bcId").val());
                        }
                        var zsAmt = 0;
                        if (!isNaN($("#zsId").val()) && $("#zsId").is(':checked')) {
                            zsAmt = parseFloat($("#zsId").val());
                        }
                        var xfAmt = 0;
                        if (!isNaN($("#xfId").val()) && $("#xfId").is(':checked')) {
                            xfAmt = parseFloat($("#xfId").val());
                        }
                        var bxAmt = 0;
                        if (!isNaN($("#bxId").val()) && $("#bxId").is(':checked')) {
                            bxAmt = parseFloat($("#bxId").val());
                        }
                        totalAmt = feeAmt + zcAmt + wcAmt + wacAmt + bcAmt + zsAmt + xfAmt + bxAmt;
                        if (isNaN(totalAmt)) {
                            totalAmt = 0;
                        } else {
                            $("#totalAmt").val(totalAmt);
                        }

                    }
                });
            </script>
</head>
<body>
<div class="container">
	<div class="row clearfix">
		<div class="col-md-12 column">
			<ul class="nav nav-pills">
				<li class="active">
					 <a href="${pageContext.request.contextPath}/bill/allBill">收银管理</a>
				</li>
				<li>
					 <a href="${pageContext.request.contextPath}/clazz/allClass">班级管理</a>
				</li>
				<li >
					 <a href="${pageContext.request.contextPath}/student/allStudent">学生管理</a>
				</li>
			</ul>
			<div class="row clearfix">
				<div class="col-md-12 column">
				</div>
			</div>
		</div>
	</div>
</div>
<div class="container">

    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>修改信息</small>
                </h1>
            </div>
        </div>
    </div>

    <form action="${pageContext.request.contextPath}/bill/updateBill" method="post">
       <span id="studentInfo">
           <hr width="30%"/>
           <input type="text" name="billId" value="${bill.billId}" hidden/>
           <input type="text" name="sno" value="${bill.sno}" hidden/>
           <table cellpadding="1" cellspacing="1" align="center" width="30%" bgcolor="#dcdcdc">
               <tr style="background-color: gainsboro;">
                   <td colspan="2" style="text-align: center;font-style: initial;">学生信息</td>
               </tr>
               <tr>
                   <th>学生姓名：</th>
                   <td><input type="text" class="amt" name="sName" id="snameId" value="${bill.sName}" disabled="disabled"/></td>
               </tr>
               <tr>
                   <th>监护人：</th>
                   <td><input type="text" class="amt" name="MonitorPhone" id="phoneId" value="${bill.monitorName}" disabled="disabled"/></td>
               </tr>
                <tr>
                    <th>联系方式：</th>
                    <td><input type="text" class="amt" name="MonitorPhone" id="phoneId" value="${bill.monitorPhone}" disabled="disabled"/></td>
                  </tr>
               <tr>
                   <th>年级班级：</th>
                   <td><select id="yearId" name="yearName" disabled="disabled">
                       <option value="幼小衔接" <c:if test="${bill.yearName == '幼小衔接'}">selected</c:if> >幼小衔接</option>
                       <option value="一年级" <c:if test="${bill.yearName ==  '一年级'}">selected</c:if>>一年级</option>
                       <option value="二年级" <c:if test="${bill.yearName=='二年级'}">selected</c:if>>二年级</option>
                       <option value="三年级" <c:if test="${bill.yearName=='三年级'}">selected</c:if>>三年级</option>
                       <option value="四年级" <c:if test="${bill.yearName=='四年级'}">selected</c:if>>四年级</option>
                       <option value="五年级" <c:if test="${bill.yearName=='五年级'}">selected</c:if>>五年级</option>
                       <option value="六年级" <c:if test="${bill.yearName=='六年级'}">selected</c:if>>六年级</option>
                       <option value="七年级" <c:if test="${bill.yearName=='七年级'}">selected</c:if>>七年级</option>
                       <option value="八年级" <c:if test="${bill.yearName=='八年级'}">selected</c:if>>八年级</option>
                       <option value="九年级" <c:if test="${bill.yearName=='九年级'}">selected</c:if>>九年级</option>
                   </select>
                       <select id="classId" name="className" disabled="disabled">
                           <option value="一班" <c:if test="${bill.className =='一班'}">selected</c:if> >一班</option>
                           <option value="二班" <c:if test="${bill.className =='二班'}">selected</c:if>>二班</option>
                           <option value="三班" <c:if test="${bill.className =='三班'}">selected</c:if>>三班</option>
                           <option value="四班" <c:if test="${bill.className =='四班'}">selected</c:if>>四班</option>
                           <option value="五班" <c:if test="${bill.className =='五班'}">selected</c:if>>五班</option>
                           <option value="六班" <c:if test="${bill.className =='六班'}">selected</c:if>>六班</option>
                       </select>
                   </td>
               </tr>
           </table>
           <hr width="30%"/>
         </span>
           <table cellspacing="1" cellpadding="1" align="center" width="30%">
               <tr style="background-color: gainsboro;">
                   <th colspan="2" style="text-align: center;font-style: initial;">缴费项目</th>
               </tr>
               <tr>
                   <th align="left">学年：<select id="zyearId" name="billYear">
                       <option value="2021年" <c:if test="${bill.billYear =='2021年'}">selected</c:if>>2021年</option>
                       <option value="2022年" <c:if test="${bill.billYear =='2022年'}">selected</c:if>>2022年</option>
                       <option value="2023年" <c:if test="${bill.billYear =='2023年'}">selected</c:if>>2023年</option>
                       <option value="2024年" <c:if test="${bill.billYear =='2024年'}">selected</c:if>>2024年</option>
                       <option value="2025年" <c:if test="${bill.billYear =='2025年'}">selected</c:if>>2025年</option>
                   </select></th>
                   <th align="left">学期：<select id="ztermId" name="billTerm">
                       <option value="上学期" <c:if test="${bill.billTerm =='上学期'}">selected</c:if>>上学期</option>
                       <option value="下学期" <c:if test="${bill.billTerm =='下学期'}">selected</c:if>>下学期</option>
                   </select></th>
               </tr>
               <tr>
                   <th align="left">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;费：</th>
                   <td align="left"><input type="text" value="${bill.fee}" name="fee" id="feeId"/></td>
               </tr>

               <tr>
                   <th align="left">其&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;它：</th>
                   <td align="left" style="text-align: left;">

                       <input type="checkbox" name="bcAmt" class="amt" id="bcId" value="${bill.bcAmt}" <c:if test="${bill.bcAmt>0}">checked</c:if>/> 班车
                       <input type="checkbox" name="bxAmt" class="amt" id="bxId" value="${bill.bxAmt}" <c:if test="${bill.bxAmt>0}">checked</c:if>/> 保险
                       <input type="checkbox" name="xfAmt" class="amt" id="xfId" value="${bill.xfAmt}" <c:if test="${bill.xfAmt>0}">checked</c:if>/> 校服
                       <input type="checkbox" name="zsAmt" class="amt" id="zsId" value="${bill.zsAmt}" <c:if test="${bill.zsAmt>0}">checked</c:if>/> 住宿
                   </td>
               </tr>
               <tr>
                   <th align="left">餐&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;费：</th>
                   <td align="left">
                       <input type="checkbox" name="zcAmt" class="amt" id="zcId" value="${bill.zcAmt}" <c:if test="${bill.zcAmt>0}">checked</c:if>/> 早餐
                       <input type="checkbox" name="wcAmt" class="amt" id="wcId" value="${bill.wcAmt}" <c:if test="${bill.wcAmt>0}">checked</c:if>/> 午餐
                       <input type="checkbox" name="wacAmt" class="amt" id="wacId" value="${bill.wacAmt}" <c:if test="${bill.wacAmt>0}">checked</c:if>/> 晚餐
                   </td>
               </tr>
               <tr>
                   <td align="left">总&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;计：</td>
                   <td align="left"><input name="totalAmt" id="totalAmt" value="0" disabled/></td>
               </tr>
           </table>
           <table cellspacing="1" cellpadding="1" align="center" width="30%">
               <tr>
                   <th align="left">收费人：</th>
                   <th align="left"><select id="sfyId" name="billOp">
                       <option value="万世钰">万世钰</option>
                       <option value="万俊杰">万俊杰</option>
                   </select></th>
               </tr>
           </table>
           <table cellspacing="1" cellpadding="1" align="center" width="30%">
               <tr>
                   <td><input type="button" name="doprint" id="doprintId" value="打印账单"></td> <td><input type="submit" value="缴费入账"/></td>
               </tr>
           </table>
           </form>


       <div id="printAearId" style="width: 30%;align-content: center;margin-left: 450px;display: none;">
           <hr style="border:1px dotted #036" />
           <table cellspacing="1" cellpadding="1" width="100%">
               <tr><th colspan="2">学生基本信息</th></tr>
               <tr><th>学生姓名：</th><td><span id="psname"></span></td></tr>
               <tr><th>学生班级：</th><td><span id="pclass"></span></td></tr>
               <tr><th>联系方式：</th><td><span id="pphone"></span></td></tr>
               <tr><td colspan="2"><hr style="border:1px dotted #036" /></td></tr>
               <tr><th colspan="2">缴费项目</th></tr>
               <tr><th>账期：</th><td><span id="pzq"></span></td></tr>
               <tr><th>学费：</th><td><span id="pfee">0</span></td></tr>
               <tr><th>早餐：</th><td><span id="pzc">0</span></td></tr>
               <tr><th>午餐：</th><td><span id="pwc">0</span></td></tr>
               <tr><th>晚餐：</th><td><span id="pwac">0</span></td></tr>
               <tr><th>校服：</th><td><span id="pxf">0</span></td></tr>
               <tr><th>保险：</th><td><span id="pbx">0</span></td></tr>
               <tr><th>班车：</th><td><span id="pbc">0</span></td></tr>
               <tr><th>住宿：</th><td><span id="pzs">0</span></td></tr>
               <tr><td colspan="2"><hr style="border:1px dotted #036" /></td></tr>
               <tr><th>小计：</th><td><span id="totalId"></span></td></tr>
               <tr><th>收费人：</th><td><span id="psfr"></span></td></tr>
           </table>
       </div>
    </form>

</div>